<template>
  <div class="main-container">
    <aside :class="['sidebar', { collapsed: sidebarStore.isCollapsed }]">
      <ChatHistory 
        v-if="!sidebarStore.isCollapsed" 
        ref="chatHistoryRef" 
      />
    </aside>

    <!-- 右侧主内容区域 -->
    <main class="main-content">
      <router-view v-if="$route.name === 'info'" />
      <ChatWindow 
        v-else
        ref="chatWindowRef" 
      />
    </main>
  </div>
</template>

<style scoped src="@/styles/MainPage.css"></style>

<script setup lang="ts">
import { ref } from 'vue'
import ChatWindow from '../components/ChatWindow.vue'
import ChatHistory from '../components/ChatHistory.vue'
import { useSidebarStore } from '../stores/sidebar'

const sidebarStore = useSidebarStore()
const chatWindowRef = ref<InstanceType<typeof ChatWindow> | null>(null)
const chatHistoryRef = ref<InstanceType<typeof ChatHistory> | null>(null)

// 处理历史对话选择事件（功能已迁移到ChatHistory组件中）

</script>
